package com.ddpt.platform.common.export.dto.permission;

import cn.hutool.core.collection.CollectionUtil;
import com.ddpt.platform.common.export.dto.ExportRequestDto;
import com.ddpt.platform.common.util.AssertUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;
import java.util.List;

@Getter
@Setter
public class AdminUserDto extends ExportRequestDto {
    //用户类型 backAdmin merchant store
    private String userType;

    //用户名
    private String userName;

    /**
     * 状态：0 - 停用，1 - 启用， 2过期
     */
    private Integer status;

    @Override
    public void verification() {
        super.verification();
        AssertUtil.isNull(this.userType, "用户类型不能为空");
        List<String> strings = Arrays.asList("backAdmin", "merchant", "store");
        AssertUtil.isTrue(!CollectionUtil.contains(strings, this.userType), "用户类型错误");
    }

    @Override
    public String montage() {
        return super.montage() + userType;
    }

    @Override
    public String getSpeType() {
        return this.userType;
    }

    @Override
    public void setSpeType(String type) {
        this.userType = type;
    }
}
